package cn.edu.cdu;

import java.awt.*;

public class GoBang {
    private final int size=24;
    private Color color;
    private Boolean isFlag;
    private int x;
    private int y;

    public GoBang(Color color, int x, int y) {
        this.color = color;
        this.x = x;
        this.y = y;
    }

    public void setFlag(Boolean flag) {
        isFlag = flag;
    }

    public Boolean getFlag() {
        return isFlag;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void draw(Graphics g){
        g.setColor(color);
        g.fillOval(x-size/2,y-size/2,size,size);
    }

    public void mark(Graphics g){
        Graphics2D gg=(Graphics2D)g;
        gg.setStroke(new BasicStroke(2f));
        gg.setColor(Color.RED);
        gg.drawLine(x-3,y,x-8,y);
        gg.drawLine(x+3,y,x+8,y);
        gg.drawLine(x,y+3,x,y+8);
        gg.drawLine(x,y-3,x,y-8);
    }

}
